#include <iostream>
#include <vector>
using namespace std;

struct position {
	int x, y;
	position(int x, int y) {
		this->x = x;
		this->y = y;
	}

	bool operator == (const position &x)const {
		return this->x == x.x && this->y == x.y;
	}
};

vector<position> book[2020][2020];
int n;
vector<position> W;

int Hash(int x) {
	return x % 2017;
}

int main() {
	int x, y;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> x >> y;
		W.push_back(position(20000 + x, 20000 + y));
		book[Hash(20000 + x)][Hash(20000 + y)].push_back(position(20000 + x, 20000 + y));
	}

	int ans = 0;
	for (unsigned i = 0; i < W.size(); ++i) {
		for (unsigned j = i + 1; j < W.size(); ++j) {
			int &x1 = W[i].x, &x2 = W[j].x;
			int &y1 = W[i].y, &y2 = W[j].y;
			int xr = x2 - x1, yr = y2 - y1;
			if (xr <= 0 || yr < 0 || (xr == 0 && yr == 0)) continue;
			int nx1 = x1 - yr, ny1 = y1 + xr;
			int nx2 = x2 - yr, ny2 = y1 + xr;
			if (nx1 < 0 || nx2 < 0 || ny1 < 0 || ny2 < 0) continue;
			
			int a = 0, b = 0;
			for (unsigned i = 0; i < book[Hash(nx1)][Hash(ny1)].size(); ++i) {
				if (book[Hash(nx1)][Hash(ny1)][i] == position(nx1, ny1)) ++a;
			}

			for (unsigned i = 0; i < book[Hash(nx2)][Hash(ny2)].size(); ++i) {
				if (book[Hash(nx2)][Hash(ny2)][i] == position(nx2, ny2)) ++b;
			}

			ans += a * b;
		}
	}

	cout << ans << endl;
	return 0;
}
